package org.osite.xml.converter;

import org.osite.xml.AttributeConverter;
import org.osite.xml.ParseContext;
import org.osite.xml.XmlParseException;

public class FloatConverter implements AttributeConverter<Float> {

  public Float convert(Class<?> type, String value, ParseContext context)
      throws XmlParseException {
    try {
      return Float.parseFloat(value);
    } catch (NumberFormatException e) {
      throw new XmlParseException("invalid float: " + value, e);
    }
  }
}
